<?php
/**
 * Vypisovaci modul ano/nie
 * @author Tomas Srna
 * @package bakalarka
 */

class GravatarWriter implements Writer
{
	public $raw = NULL;
	
	public function set($raw)
	{
		$this->raw = $raw;
		return $this;
	}
	
	public function __toString()
	{
		$url = 'http://gravatar.com/avatar/%s.jpg?s=80&d=identicon';
		return '<img alt="Gravatar" class="gravatar" src="'.
					sprintf($url, md5($this->raw)).'" />';
	}
	
	public function write()
	{
		echo (string)$this;
	}
}
